package com.aia.prm.web.ria.app;

import java.io.Serializable;

import com.aia.prm.web.ria.app.ui.G2View;
import com.aia.prm.web.ria.app.ui.config.ConfigView;
import com.aia.prm.web.ria.app.ui.qnpe.QnpeView;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

@SuppressWarnings("serial")
public class MyMenu implements Serializable {
	G2View g2View;
	PrmApplication prmApplication;

	public MyMenu(G2View arg, PrmApplication arg2) {
		g2View = arg;
		prmApplication = arg2;
	}

	public MenuBar buildMenuBar() {
		MenuBar menubar = new MenuBar();
		final MenuBar.MenuItem systemMenu = menubar.addItem("系统菜单", null);
		systemMenu.setIcon(new ThemeResource("icons/applications.png"));
		systemMenu.addItem("系统参数配置", new Command() {
			public void menuSelected(MenuItem selectedItem) {
				g2View.addTab(new ConfigView(prmApplication), selectedItem.getText());
			}
		});
		systemMenu.addItem("aia1项目报表", new Command() {
			public void menuSelected(MenuItem selectedItem) {
				g2View.addTab(new QnpeView(prmApplication), selectedItem.getText());
			}
		});
		return menubar;
	}
}
